package tester.anticheeting;

import tester.Person;
import tester.Problem;

/**
 * Created by IntelliJ IDEA.
 * User: aleck
 * Date: 2007-10-27
 * Time: 14:42:00
 * To change this template use File | Settings | File Templates.
 */
public class Record implements Comparable {
  public final Person p1;
  public final Person p2;
  public final Problem problem;
  public final int similarity;

  public Record(Person p1, Person p2, Problem problem, int similarity) {
    this.problem = problem;
    this.p2 = p2;
    this.p1 = p1;
    this.similarity = similarity;
  }

  public int compareTo(Object o) {
    Record rec = (Record) o;
    if (similarity < rec.similarity)
      return 1;
    else if (similarity > rec.similarity)
      return -1;
    else {
      if (p1.name.equals(rec.p1.name))
        return -p2.name.compareTo(rec.p2.name);
      else
        return -p1.name.compareTo(rec.p1.name);
    }
  }
}

